/*
 * Eugen Stoian <stoian.e@gmail.com> 2010
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef VALUENODE_H
#define VALUENODE_H

#include <ExpressionTreeNode.h>

class ValueNode : public ExpressionTreeNode
{
public:
    ValueNode(Real value = Real(0.0));

    virtual ExpressionTreeNode* copy() const ;

    virtual Real eval( ) const;

    virtual SmartPtr<ExpressionTreeNode> derive(const QString& varName) const;

    virtual QString info() const;

    /**
     *\fn bool isValue() const
     *\brief Returns true
     * Reimplemented from ExpressionTreeNode
     *
     */
    inline virtual bool isValue() const {
        return true;
    }

    virtual QString toPrefixString() const;

    virtual QString toPostfixString() const;

    virtual QString toInfixString() const;

    inline virtual int precedence() const {
        return DEFAULT_PRECEDENCE;
    }

    virtual SmartPtr<ExpressionTreeNode> firstLevelSimplification() const;

    virtual void bind(int, const Real * ) const{
    }


    virtual void bind(const QString&, const Real * ) const{
    }

    virtual ExpressionTreeNode* replace(const QString& varName, ExpressionTreeNode* tree) const;

    virtual ExpressionTreeNode* replace(int varPos, ExpressionTreeNode* tree) const;

    virtual void resetMarker() const{
    }

protected:
    Real _value;
};

#endif // VALUENODE_H
